import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import IconsResolver from 'unplugin-icons/resolver';
import { PlatformPath } from 'path';

export default (path: PlatformPath) => {
  return Components({
    extensions: ['vue'],
    resolvers: [
      // auto import element plus components
      ElementPlusResolver(),
      // auto resolve icons
      IconsResolver({
        prefix: 'icon',
        enabledCollections: ['ep', 'ic']
      })
    ],
    dts: path.resolve(path.resolve(__dirname, '../../src'), 'types', 'components.d.ts')
  });
};
